﻿using System;
using System.Collections.Generic;
using System.Text;
using DirectUI.Mobile.UI;
using NMock2;
using Microsoft.VisualStudio.TestTools.UnitTesting;
//using Xunit;
using System.Threading;
namespace UnitTest
{
    [TestClass()]
 public  class AnimationTest
    {
     /// <summary>
        /// 匀速模式，应该触发Scene事件Interval/Duration(+10 or -10)次，value值域必须属于(beginValue,endValue)
     /// </summary>
    [TestMethod()]
        public void Start_Should_Fire_SceneEvent_As_Expect_LinearMode()
     {
         Animation animation = new Animation(2000, 0, 1000);
      //   animation.Interval = 10;
         int counts = 0;
         animation.Scene += new EventHandler<AnimationEventArgs>(
             delegate(object sender, AnimationEventArgs e)
             {
                 Assert.IsTrue(e.Value <= 1000);
                 counts++;
             }
             );
         animation.Start(40);
        Thread.Sleep(2500);
        Assert.IsTrue(animation.IsCompleted);
        int different = 50 - counts;
        Assert.IsTrue(different < 10);
     }
    }
}
